from  transformers import GPT2LMHeadModel, GPT2Config
# import sys
# import os
# sys.path.append(os.path.abspath(".."))
from parameter_config import ParameterConfig

def get_model():
    params = ParameterConfig()
    # 非空即为True
    if params.pretrained_model:
        model = GPT2LMHeadModel.from_pretrained(params.pretrained_model)
    else:
        model_config = GPT2Config.from_json_file(params.config_json)
        model = GPT2LMHeadModel(config=model_config)
    return model
